﻿#ifndef CONTROLLER_H
#define CONTROLLER_H

#include <QThread>
#include <QQueue>
#include <QTimer>

class Producer;
class Customer;
class QThread;

class Controller : public QObject
{
    Q_OBJECT
public:
    explicit Controller(QObject *parent = nullptr);
    ~Controller();

    inline static QQueue<QString>* getQueue() { return &queue; };

    Q_INVOKABLE void runTask();

signals:
    void producerLog(const QString &msg);
    void customerLog(const QString &msg);

private:
    Producer *producer = nullptr;
    Customer *customer = nullptr;

    static QQueue<QString> queue;

    QTimer *timer;
    QStringList pdBuffer;
    QStringList ctBuffer;
};

#endif // CONTROLLER_H
